import cn.hutool.crypto.digest.MD5;

public class server {
    private final static String secretKey = "BXQXITmPaaQCgTP7lXNnYJADWBxr4Spm"; //不能参与传输
    private final String appId = "CZI2DyKnKt4z8n2KPV5OmClA";

    public static String getSecretKey() {
        return secretKey;
    }

    public String decrypt(String encryptMsg) {
        String content = null;
        try {
//            content = AESUtil.decrypt(encryptMsg, secretKey, EncryptDemo.nonce);
        } catch (Exception e) {
            e.printStackTrace();
        }

        System.out.println("解密后内容：" + content);

        return content;
    }

    public boolean validSignature(String signature, String appId, String encryptMsg) {
//        if (!this.appId.equals(appId)) {
//            System.out.println("appid不存在");
//            return false;
//        }
//
//        //十分钟
//        if(System.currentTimeMillis() - EncryptDemo.timestamp > 10 * 60 * 1000L) {
//            System.out.println("该请求超时");
//            return false;
//        }
//
//        //nonce是否有效
//
//        String signPayload = appId + "," + EncryptDemo.timestamp + "," + EncryptDemo.nonce + "," + encryptMsg;
//
//        String tempSignature = MD5.create().digestHex(signPayload);
//        if (!tempSignature.equals(signature)) {
//            System.out.println("签名不合法");
//            return false;
//        }

        return true;
    }

}